package org.jetnuke.blocks;

import javax.servlet.http.HttpServletRequest;

import org.apache.velocity.VelocityContext;
import org.jetnuke.common.IAdminInfo;
import org.jetnuke.common.IBlock;
import org.jetnuke.common.IBlockInfo;
import org.jetnuke.common.IUserInfo;
import org.jetnuke.dao.DataAccessDriver;
import org.jetnuke.dao.DownloadModRequestDAO;

public class WaitingContent implements IBlock {

	public void serviceBlock(HttpServletRequest req, VelocityContext vc,
			IBlockInfo blockInfo, IUserInfo userInfo, IAdminInfo adminInfo)
			throws Exception {
		vc.put("numSubmissions", new Integer(DataAccessDriver.getInst().newQueueDAO().countAll()));// queuePeer.count(new Criteria())));
		vc.put("numWaitReviews", new Integer(
				DataAccessDriver.getInst().newReviewsAddDAO().countAll()));
				//reviews_addPeer
				//.count(new Criteria())));
		vc
				.put("numLinks", new Integer(
						DataAccessDriver.getInst().newLinkNewLinkDAO().countAll()));
						//links_newlinkPeer
						//.count(new Criteria())));
		vc
				.put("brokenLinks", new Integer(DataAccessDriver.getInst().newLinkModRequestDAO().countBroken()));
						
						//links_modrequestPeer
						//.count(new Criteria().add(
								//links_modrequestPeer.BROKENLINK, 1))));
		vc
				.put("modLinks",  new Integer(DataAccessDriver.getInst().newLinkModRequestDAO().countModified()));
						//.count(new Criteria().add(
						//		links_modrequestPeer.BROKENLINK, 0))));

		vc.put("new_down", new Integer(DataAccessDriver.getInst().newDownloadNewDownloadDAO().countAll()));
				
//				downloads_newdownloadPeer
				//.count(new Criteria())));
		DownloadModRequestDAO dmrm=DataAccessDriver.getInst().newDownloadModRequestDAO();
		vc.put("mod_down", new Integer(
				dmrm.countModified())); 
				
//				downloads_modrequestPeer
	//			.count(new Criteria().add(
		//				downloads_modrequestPeer.BROKENDOWNLOAD, 0))));
		vc.put("broken_down", new Integer(
				dmrm.countBroken()));
				//downloads_modrequestPeer
				//.count(new Criteria().add(
					//	downloads_modrequestPeer.BROKENDOWNLOAD, 1))));
	}

}
